(define (abs x)
    (cond 
        ((> x 0) x )
        ((= x 0) 0 )
        ((< x 0) (- x))
    )
)

(define (abs2 x)
    (if [< x 0] (- x) x)
)

;(pretty-print (abs2 -15))

(define (sqrt-iter guess x)
    (if (good-enough? guess x)
        guess
        (sqrt-iter (improve guess x) x)
    )
)
(define (improve guess x)
    (average guess (/ x guess))
)
(define (average x y)
    (/ (+ x y) 2)
)
(define (good-enough? guess x)
    (< 
        (abs (- (square guess) x))
        0.001
    )
)
(define (square x)
    (* x x)
)
(define (sqrt1 x)
    (sqrt-iter 1.0 x)
)
(pretty-print (sqrt 36))
